projects
/
cargo.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
99736d8
)
Show a warning when the package is renamed
author
Chris Wong
<lambda.fairy@gmail.com>
Tue, 21 Apr 2015 23:28:21 +0000
(11:28 +1200)
committer
Chris Wong
<lambda.fairy@gmail.com>
Fri, 24 Apr 2015 05:00:01 +0000
(17:00 +1200)
src/cargo/ops/cargo_new.rs
patch
|
blob
|
history
diff --git
a/src/cargo/ops/cargo_new.rs
b/src/cargo/ops/cargo_new.rs
index d75c2b38062cca092413a9d320b027726c8a68f2..19fe553060614441017e4ae53f7cf1b07b21aff0 100644
(file)
--- a/
src/cargo/ops/cargo_new.rs
+++ b/
src/cargo/ops/cargo_new.rs
@@
-8,6
+8,8
@@
use rustc_serialize::{Decodable, Decoder};
use git2::Config as GitConfig;
+use term::color::BLACK;
+
use util::{GitRepo, HgRepo, CargoResult, human, ChainError, internal};
use util::Config;
@@
-57,7
+59,14
@@
pub fn new(opts: NewOptions, config: &Config) -> CargoResult<()> {
if opts.bin {
dir_name
} else {
- strip_rust_affixes(dir_name)
+ let new_name = strip_rust_affixes(dir_name);
+ if new_name != dir_name {
+ let message = format!(
+ "Note: package will be named `{}`; use --name to override",
+ new_name);
+ try!(config.shell().say(&message, BLACK));
+ }
+ new_name
}
}
};